package class202205.demo15.demo13.Queue;

import java.util.LinkedList;
import java.util.Queue;

public class Test {

    public static void main(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        //入队列
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);

        //出队列
        //Integer val = queue.poll();
        //System.out.println(val);

        //获取队头元素，但不删除
        System.out.println(queue.peek());
    }

    public static void main1(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        //入队列
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);

        //出队列
        //Integer val = queue.poll();
        //System.out.println(val);

        //获取队头元素，但不删除
        System.out.println(queue.peek());
    }
}
